<%@page import="java.sql.SQLException"%>
<%@page import="java.sql.ResultSet"%>
<%@page import="java.sql.PreparedStatement"%>
<%@page import="java.sql.Connection"%>
<%@page import="DBConnection.ConnectionFactory"%>
<%@page import="ContentManagers.RoleManagers.AuthenticationManager"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<!DOCTYPE html>
<html>
    <head>
        <link rel="stylesheet" type="text/css" href="css/managing_int.css" />
    </head>
    <body>
    <% //employ temporary session management here
            try{
            boolean check = false;
        
            check = new AuthenticationManager().inSuchDB(3, request, response);
            
            if(check == true)
            {
        %>
                <%@ include file="managing_header.jsp"%>
                <% //Call admin header file. The header contains the links for other pages. %>


                <div id ="body_wrapper">
                    <% //Actual Content of the Index page starts here. %>

                        <%@ include file="pm_index.jsp" %>

                    <% //Actual Content of the Index page ends here. %>
                </div>


                <%@ include file="managing_footer.jsp" %>
                <% //Call default footer file %>
                </body>
    
    <%       }
          else
          {  
             check = new AuthenticationManager().inSuchDB(4, request, response);
             
             if(check == true)
               { %>
                <%@ include file="accounting_header.jsp"%>
                <% //Call admin header file. The header contains the links for other pages. %>


                <div id ="body_wrapper">
                    <% //Actual Content of the Index page starts here. %>

                        <%@ include file="am_spp.jsp" %>

                    <% //Actual Content of the Index page ends here. %>
                </div>


                <%@ include file="managing_footer.jsp" %>
                <% //Call default footer file %>
                </body>
             
                <%}
             
             else
                 new AuthenticationManager().redirectToProperIndex(3, request, response);
                
          }               
            
    }catch(Exception e)
        {   session = request.getSession();
            session.setAttribute("username", "xxxxdefaultxxxx");
            session.setAttribute("sessionID", "xxxxdefaultxxxx");
        
            response.sendRedirect("../index.jsp");}
            
%>
</html>